#!/usr/bin/env Rscript
## This file runs BRS with bootstrapping on the democracy example

# Parameters for BRS
numMine <- 5000L  # number of rules to be used in SA_patternbased and also the output of generate_rules
numIter <- 1000L  # number of iterations in each chain
numChain <- 2L  # number of chains in the simulated annealing search algorithm
supp <- 5L  # minimum support
maxLen <- 3L  # maxmum length of a rule
alpha_1 <- 500e2L  # alpha_+
beta_1 <- 1e2L  # beta_+
alpha_2 <- 500e2L  # alpha_-
beta_2 <- 1e2L  # beta_-
lambda <- 1
nu <- 1    # note: BRS_0.0.0.9006 uses nu to refer to eta from the paper
reps <- 100L  # number of bootstrap reps
trainProp <- 1   # proportion of data to use as training

# Run BRS
set.seed(123)
out_lipset_boot <- BRS(df=X, Y=Y,
                       maxLen=maxLen, trainProp=trainProp,
                       numIter=numIter, numChain=numChain,
                       supp=supp, numMine=numMine,
                       alpha_1=alpha_1, alpha_2=alpha_2,
                       beta_1=beta_1, beta_2=beta_2,
                       prior_type="poisson",
                       alpha_l=NULL, beta_l=NULL,  # not used for the poisson version
                       lambda=lambda, nu=nu,    # note: BRS_0.0.0.9006 uses nu to refer to eta from the paper
                       bootstrap=T, reps=100L,
                       print=F,
                       seed=sample.int(1e5, size=1))

save(out_lipset_boot, file="lipset/out/lipset_out_pois.rda")


